home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
007
/
scrn.c
< prev
next >
Wrap
Text File
|
1985-06-03
|
3KB
|
115 lines
/*************************************************************************
scrn - function allows colors and/or attributes of color display to be set
when using ansi.sys on dos v2.0.
scrn parm [parm2]
where parm1 and 2 may be the name of a color or attribute as shown below.
Only lower case commands are checked for.
written by Rex Jaeschke of Rockville, MD. 1983 (301) 251-8987
compiler used DeSmet v2.2
*************************************************************************/
#define ESCAPE 27
#define RESET 0
#define BOLD 1
#define UNDERSC 4
#define BLINK 5
#define REVERSE 7
#define INVIS 8
#define FBLACK 30 /* foreground colors */
#define FRED 31
#define FGREEN 32
#define FYELLOW 33
#define FBLUE 34
#define FMAGENTA 35
#define FCYAN 36
#define FWHITE 37
#define BBLACK 40 /* background colors */
#define BRED 41
#define BGREEN 42
#define BYELLOW 43
#define BBLUE 44
#define BMAGENTA 45
#define BCYAN 46
#define BWHITE 47
main (argc,argv)
int argc;
char *argv[];
{
if (argc < 2) {
printf ("Must have at least one parameter.\n");
return;
}
else
{
if (strcmp (argv[1],"black") == 0)
scr_sgr (FBLACK);
else if (strcmp (argv[1],"red") == 0)
scr_sgr (FRED);
else if (strcmp (argv[1],"green") == 0)
scr_sgr (FGREEN);
else if (strcmp (argv[1],"yellow") == 0)
scr_sgr (FYELLOW);
else if (strcmp (argv[1],"blue") == 0)
scr_sgr (FBLUE);
else if (strcmp (argv[1],"magenta") == 0)
scr_sgr (FMAGENTA);
else if (strcmp (argv[1],"cyan") == 0)
scr_sgr (FCYAN);
else if (strcmp (argv[1],"white") == 0)
scr_sgr (FWHITE);
else if (strcmp (argv[1],"reset") == 0)
scr_sgr (RESET);
else if (strcmp (argv[1],"bold") == 0)
scr_sgr (BOLD);
else if (strcmp (argv[1],"undersc") == 0)
scr_sgr (UNDERSC);
else if (strcmp (argv[1],"blink") == 0)
scr_sgr (BLINK);
else if (strcmp (argv[1],"reverse") == 0)
scr_sgr (REVERSE);
else if (strcmp (argv[1],"invis") == 0)
scr_sgr (INVIS);
else if (strcmp (argv[1],"same") != 0)
printf ("First parameter is invalid.\n");
}
if (argc >= 3) {
if (strcmp (argv[2],"black") == 0)
scr_sgr (BBLACK);
else if (strcmp (argv[2],"red") == 0)
scr_sgr (BRED);
else if (strcmp (argv[2],"green") == 0)
scr_sgr (BGREEN);
else if (strcmp (argv[2],"yellow") == 0)
scr_sgr (BYELLOW);
else if (strcmp (argv[2],"blue") == 0)
scr_sgr (BBLUE);
else if (strcmp (argv[2],"magenta") == 0)
scr_sgr (BMAGENTA);
else if (strcmp (argv[2],"cyan") == 0)
scr_sgr (BCYAN);
else if (strcmp (argv[2],"white") == 0)
scr_sgr (BWHITE);
else if (strcmp (argv[2],"same") != 0)
printf ("Second parameter is invalid.\n");
}
if (argc > 3)
printf ("Too many parameters.\n");
}
scr_sgr (attrib)
int attrib;
{
printf ("%c[%dm",ESCAPE,attrib);
}
(argc > 3)
printf ("Too many parameters.\n");
}
scr_sgr (attri